er
<script setup lang="ts">
import { ref } from 'vue'
import { getImageUrl } from '../../utils/index'
const windowStatus = ref<boolean>(false)

/**
 * 窗口操作
 *
 * @param {number} type 0:最小化 1:最大化 2:关闭
 */
const winFunc = (type: number) => {
  switch (type) {
    case 0:
      window.api.decreaseWin()
      break
    case 1:
      windowStatus.value = !windowStatus.value
      // ipcRenderer.send('winsize', windowStatus.value)
      break
    default:
      // ipcRenderer.send('close')
      break
  }
}
</script>
<template>
  <div class="title-bar w-full bg-[#24ADF3] flex items-center justify-between h-10 pl-2">
    <img class="-w-full h-full pt-2 pb-2" src="../../assets/images/icon.png" alt="logo" />
    <div class="flex items-center h-full">
      <img
        :src="getImageUrl('decrease', 'svg')"
        alt=""
        class="h-full cursor-pointer p-2 hover:bg-[#E5E5E5]"
        title="最小化"
        @click="winFunc(0)"
      />
      <img
        :src="windowStatus ? getImageUrl('minimization', 'svg') : getImageUrl('maximize', 'svg')"
        alt=""
        class="h-full cursor-pointer p-2 hover:bg-[#E5E5E5]"
        :title="windowStatus ? '还原' : '最大化'"
        @click="winFunc(1)"
      />
      <img
        :src="getImageUrl('close', 'svg')"
        alt=""
        class="h-full cursor-pointer p-2 hover:bg-[#E81123]"
        @click="winFunc(2)"
      />
    </div>
  </div>
</template>
<style lang="less" scoped>
.title-bar {
  -webkit-app-region: drag;
}
</style>
